< previous page page_235 next page >

Page 235
e10a6a0a59f035e870d90cca05b85fce.gif
      ' Save the frames' bytes.
      Put #fnum, , Bytes

      ' Close the file.
      Close #fnum
  End Sub

' Load a sequence of images from a single file.
Private Sub LoadSequence(file_name As String)
Dim fnum As Integer
Dim wid As Single
Dim hgt As Single

    ' Open the file.
    fnum = FreeFile
    Open file_name For Binary Access Read As #fnum

    ' Get the number of frames and the frame size.
    Get #fnum, , NumImages
    Get #fnum, , wid
    Get #fnum, , hgt
    Get #fnum, , BytesPerImage

    ' Resize the display picture box.
    picCanvas.AutoRedraw = False
    picCanvas.Width = wid
    picCanvas.Height = hgt
    picCanvas.Picture = picCanvas.Image

    ' Get the frames' bytes.
    MaxImage = NumImages - 1
    ReDim Bytes(1 To BytesPerImage, 0 To MaxImage)
    Get #fnum, , Bytes

    ' Close the file.
    Close #fnum

    ' Display the first image.
    SetBitmapBits picCanvas.Image, BytesPerImage, Bytes(1, 0)
    picCanvas.Refresh
    lblResults.Caption = "" 
    txtNumFrames.Text = Format$(NumImages)
End Sub
The Need for Speed
The programs described so far may seem to take the pursuit for speed to extremes. Program PlayWait can display far more than the 20 or so frames per second needed for smooth animation. So why bother with such elaborate methods to achieve this overkill?

 
< previous page page_235 next page >